
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>请列举出常见的排序方法有哪些？ - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>请列举出常见的排序方法有哪些？ - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">冒泡排序 (Bubble Sort) 的核心工作原理是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">通过重复地比较相邻的元素并交换它们（如果它们的顺序错误）。这个过程会在每次遍历时把最大（或最小）的元素“冒泡”到数组的末尾。</div>
          </div>
          <div class="card-source">来源: 1. 冒泡排序 (Bubble Sort)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">归并排序 (Merge Sort) 是如何利用“分而治之”策略进行排序的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">它将数组分割成两个子数组，分别对这两个子数组进行排序，然后合并这两个已排序的子数组。</div>
          </div>
          <div class="card-source">来源: 4. 归并排序 (Merge Sort)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">快速排序 (Quick Sort) 在平均情况和最坏情况下的时间复杂度分别是多少？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">平均情况下的时间复杂度为 O(n log n)，最坏情况下的时间复杂度为 O(n^2)。</div>
          </div>
          <div class="card-source">来源: 5. 快速排序 (Quick Sort)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">插入排序 (Insertion Sort) 在什么情况下效率最高，能达到 O(n) 的时间复杂度？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">在处理部分已排序的数组时效率较高，其最好情况下的时间复杂度为 O(n)。</div>
          </div>
          <div class="card-source">来源: 3. 插入排序 (Insertion Sort)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">堆排序 (Heap Sort) 的基本步骤是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">首先将数组构建成一个堆（通常是最大堆），然后将堆顶元素（最大值）取出并调整堆结构，重复此过程直到所有元素排序完成。</div>
          </div>
          <div class="card-source">来源: 6. 堆排序 (Heap Sort)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">计数排序 (Counting Sort) 适用于什么场景，其时间复杂度与哪些因素有关？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">适用于数据范围较小的情况。其时间复杂度为 O(n + k)，其中 n 是元素数量，k 为数据范围。</div>
          </div>
          <div class="card-source">来源: 7. 计数排序 (Counting Sort)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">希尔排序 (Shell Sort) 是如何对插入排序进行改进的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">它基于插入排序，通过比较相距一定间隔的元素来进行排序，然后逐渐缩小间隔，从而比简单的插入排序更高效。</div>
          </div>
          <div class="card-source">来源: 10. 希尔排序 (Shell Sort)</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">比较</div>
          <div class="card-question">在所列出的算法中，哪些算法的空间复杂度为 O(1)，即不需要额外的内存空间？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">比较</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">冒泡排序 (Bubble Sort)、选择排序 (Selection Sort)、插入排序 (Insertion Sort)、堆排序 (Heap Sort) 和希尔排序 (Shell Sort) 的空间复杂度均为 O(1)。</div>
          </div>
          <div class="card-source">来源: 1. 冒泡排序, 2. 选择排序, 3. 插入排序, 6. 堆排序, 10. 希尔排序</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">尽管归并排序 (Merge Sort) 具有稳定的 O(n log n) 时间复杂度，但它的主要缺点是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">它的主要缺点是需要额外的内存空间，其空间复杂度为 O(n)。</div>
          </div>
          <div class="card-source">来源: 4. 归并排序 (Merge Sort)</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
